home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snpd1292.zip / CURSIZE.C < prev    next >
C/C++ Source or Header  |  1992-12-26  |  2KB  |  67 lines

  1. /*
  2. **  Program to set the size of the cursor
  3. **
  4. **  Public domain demonstration by Bob Jarvis
  5. */
  6.  
  7. #include <stdio.h>      /* puts()              */
  8. #include <dos.h>        /* int86(), union REGS */
  9. #include <stdlib.h>     /* exit(), atoi()      */
  10.  
  11. char *help =  "CURSIZE - sets the cursor size.\n"
  12.               "Usage:\n"
  13.               "   CURSIZE <top-line> <bottom-line>\n"
  14.               "where\n"
  15.               "   top-line = top line of cursor within character cell\n"
  16.               "   bottom-line = bottom line\n"
  17.               "Example:\n"
  18.               "   CURSIZE 7 8     <set cursor to bottom 2 lines of VGA>\n"
  19.               "   CURSIZE 32 32   <turns cursor off>";
  20.  
  21. void cursor_size(int top_line, int bottom_line)
  22. {
  23.       union REGS regs;
  24.  
  25.       regs.h.ah = 1;
  26.       regs.h.ch = top_line;
  27.       regs.h.cl = bottom_line;
  28.  
  29.       int86(0x10,®s,®s);
  30. }
  31.  
  32. void get_cursor_size(int *top_line, int *bottom_line)
  33. {
  34.       union REGS regs;
  35.  
  36.       regs.h.ah = 3;
  37.       regs.h.bh = 0;
  38.       int86(0x10, ®s, ®s);
  39.  
  40.       *top_line = regs.h.ch;
  41.       *bottom_line = regs.h.cl;
  42.  
  43.       return;
  44. }
  45.  
  46. main(int argc, char *argv[])
  47. {
  48.       int top, bottom;
  49.  
  50.       if(argc < 3)
  51.       {
  52.             puts(help);
  53.             exit(1);
  54.       }
  55.  
  56.       top = atoi(argv[1]);
  57.       bottom = atoi(argv[2]);
  58.  
  59.       cursor_size(top,bottom);
  60.  
  61.       top = bottom = -1;
  62.  
  63.       get_cursor_size(&top, &bottom);
  64.  
  65.       printf("top = %d  bottom = %d\n", top, bottom);
  66. }
  67.